{layout name="ucenter/layout" /}
<form class="layui-form" action="">
  <div class="layui-form-item">
    <label class="layui-form-label">旧密码</label>
    <div class="layui-input-inline">
      <input type="password" name="oldPassword" required lay-verify="required" placeholder="请输入旧密码" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">新密码</label>
    <div class="layui-input-inline">
      <input type="password" name="password" required lay-verify="required" placeholder="请输入新密码" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">重复密码</label>
    <div class="layui-input-inline">
      <input type="password" name="repwd" required lay-verify="required" placeholder="重复密码" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo">修改</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

<script>
  layui.use('form', function(){
    var form = layui.form;
    form.on('submit(formDemo)', function(data){
      var formData = data.field;
      $.ajax({
        type:"post",
        data:formData,
        url:"{:url('repassword')}",
        success:function(e){
          layer.msg(e.msg);
        }
      });
      return false;
    });
  });
</script>